<?php
    class user_profile_controller extends controllerBase
    {
        public function process()
        {
            $uri = URL::getLink('profile/id/'.$this->iId);
            $graph = new Graphite();
            $graph->ns('bus',URL::getLink('id/bussiness#'));
            $graph->setDebug( true );
            $graph->load($uri );
            $this->aParams['fullname'] = $graph->resource($uri)->getLiteral('foaf:familyName');
            $this->aParams['username'] = $graph->resource($uri)->getLiteral('foaf:givenName');
            $this->aParams['address'] = $graph->resource($uri)->getLiteral('bus:location');
            $this->aParams['email'] = $graph->resource($uri)->getLiteral('foaf:mbox');
            
            if($graph->resource($uri)->has('bus:image'))
            {
                $this->aParams['image'] = $graph->resource($uri)->getLiteral('bus:image');
            }
            if($graph->resource($uri)->has('bus:followUser'))
            {
                $aListUsers = $graph->resource($uri)->getList('bus:followUser');
                $aUserFollows = array();
                foreach($aListUsers as $key => $sUserUri)
                {
                    $graph->load($sUserUri);
                    $aUserFollows[$sUserUri]['uri'] = $sUserUri;
                    $aUserFollows[$sUserUri]['fullname'] = $graph->resource($sUserUri)->getLiteral('foaf:familyName');
                    $aUserFollows[$sUserUri]['image'] = $graph->resource($sUserUri)->getLiteral('bus:image');
                }
                $this->aParams['aUserFollows'] =$aUserFollows;
            }
        }
    }
?>
